package com.bw.coll;

import com.bw.bean.Emp;
import com.bw.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EmpColl {

    @Autowired
    EmpService emp;

    @RequestMapping("/list1")
    public List getList1(Integer money, String jdata1, String jdata2){
        List<Emp> list = emp.getList(money, jdata1, jdata2);
        return list;
    }

    @RequestMapping("/list2")
    public List getList2(){
        List<Emp> list2 = emp.getList2("%手机%");
        return list2;
    }

    @RequestMapping("/list3")
    public int getAdd(String name,Integer num,Integer money,String jdata,Integer cid){
        int i = emp.tjAdd(name, num, money, jdata, cid);
        System.out.println(i>0?"添加成功":"添加失败");
        return i;
    }

    @RequestMapping("/list4")
    public int getDele(Integer id){
        int i = emp.scDele(id);
        System.out.println(i>0?"删除成功":"删除失败");
        return i;
    }

    @RequestMapping("/list5")
    public int getUpdate(){
        int i = emp.xgUpdata();
        System.out.println(i>0?"修改成功":"修改失败");
        return i;
    }

}
